<template>
	<view>
		<map style="width: 450px;height:700px;" latitude="38.04276" longitude="114.5143" :markers="markers" @callouttap="dian"></map>
		<!-- <map style="width: 100%;height:100vh;" :latitude="latitude" :longitude="longitude" :markers="markers"></map> -->
	</view>
</template>

<script>
export default {
	data() {
		return {
			token: '',
			title: 'map',
			latitude: '',
			longitude: '',
			markers: []
		};
	},
	onLoad() {
		this.getStoreLatLong();
		let that = this;
		uni.getLocation({
			type: 'wgs84',
			success: function(res) {
				console.log('当前位置的经度：' + res.longitude);
				console.log('当前位置的纬度：' + res.latitude);
				that.longitude = res.longitude;
				that.latitude = res.latitude;
				that.getStoreLatLong(res.longitude, res.latitude);
			}
		});
	},
	methods: {
		dian(e){
			console.log(e)
		},
		map_tap(e){
			console.log(e)
			console.log("点击事件")
			uni.navigateTo({
				url:'/pages/store/index'
			})
		},
		getStoreLatLong(longitude, latitude) {
			console.log(123);
			uni.request({
				url: 'https://b10.bwyljy.com/api/getStoreLatLong',
				method: 'GET',
				header: {
					'content-type': 'application/x-www-form-urlencoded'
				},
				success: res => {
					console.log('测试接口');
					console.log(res);
					let arr=[]
					arr.push(res.data.data)
					this.markers = res.data.data
					console.log(this.markers)
				},
				fail: err => {
					console.log('失败接口');
					console.log(err);
				}
			});
		}
	}
};
</script>

<style>
	
</style>
